package unittests;


import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;

import simple.DockEvent;
import simple.GpsDock;
import simple.GpsUnit;
import simple.IDockListener;
import simple.enums.BaudRate;
import simple.enums.DataBits;
import simple.enums.Parity;
import simple.enums.StopBits;


public class GpsDockTest extends TestCase {
	
	GpsDock dock;
	GpsUnit unit;
	boolean receivedEvent;
	
	public void testGpsDock(){
		dock.setUnit(unit);
		assertTrue("Test if event is received", receivedEvent);
	}
	
	@Before
	public void setUp() throws Exception {
		receivedEvent = false;
		
		unit = new GpsUnit(BaudRate._115200, DataBits.EIGHT, StopBits.ONE, Parity.NONE);
		dock = new GpsDock();
		
		dock.registerDockListener(new IDockListener(){

			@Override
			public void unitDocked(DockEvent event) {
				receivedEvent = true;
			}});
	}

	@After
	public void tearDown() throws Exception {
	}

}
